package com.zigong.app.ui.adapter.holder;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.view.View;

import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.zigong.app.R;
import com.zigong.app.base.BaseActivity;
import com.zigong.app.beans.FProgram;
import com.zigong.app.ui.activities.TopicDetailActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/7/19 0019.
 */

public class SearchResultTopicconHolder extends BaseSearchReultHolder<FProgram> implements View.OnClickListener {
    @BindView(R.id.item_search_result_top_content_title)
    protected CustomFontTextView title;
    private String topicUrl;

    public SearchResultTopicconHolder(Context context, View itemView) {
        super(context, itemView);
        itemView.setOnClickListener(this);
    }

    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(FProgram fProgram) {
        title.setText(!TextUtils.isEmpty(fProgram.getProgrammeTitle()) ? fProgram.getProgrammeTitle() : "");
        topicUrl = fProgram.getProgrammeUrl();
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent(context, TopicDetailActivity.class);
        intent.putExtra(BaseActivity.EX_URL, topicUrl);
        context.startActivity(intent);
    }

}
